
package presentationTier.actions;

import businessTier.IMovieFacade;
import businessTier.MovieFacade;
import core.Genre;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import presentationTier.dialogs.AddGenreDialog;

/**
 *
 * @author vojta
 */
public class AddGenreOkAction implements ActionListener{

    AddGenreDialog dialog;

    public AddGenreOkAction(AddGenreDialog aThis) {
        dialog = aThis;
    }

    public void actionPerformed(ActionEvent e) {
        try {
            String name = dialog.txtName.getText();
            IMovieFacade f = MovieFacade.getInstance();
            Genre genre = new Genre(name);
            //JOptionPane.showMessageDialog(dialog, medium.getMedium());
            f.addGenre(genre);
            f.close();
            
            dialog.dispose();
        } catch (Exception ex) {
            
        }
    }

}
